package com.jinyang.jetpackdemo.activity

import android.os.Bundle
import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity
import butterknife.BindString
import butterknife.BindView
import butterknife.ButterKnife
import butterknife.OnClick
import com.jinyang.annotation.GetTime
import com.jinyang.annotation.LjyBindView
import com.jinyang.jetpackdemo.MyAnnotation
import com.jinyang.jetpackdemo.R
import com.jinyang.jetpackdemo.annotation.LjyButterKnife
import com.jinyang.jetpackdemo.util.LjyLogUtil


/**
 * APT编译时注解
 */
class ButterKnifeActivity : AppCompatActivity() {

    @BindView(R.id.et_name)
    lateinit var etName: EditText

    @BindView(R.id.et_pwd)
    lateinit var etPwd: EditText

    @BindString(R.string.login_error)
    lateinit var loginErrorMessage: String

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_butter_knife)
        ButterKnife.bind(this)
        LjyButterKnife.bind(this)
    }

    @OnClick(R.id.btn_submit)
    fun submit() {
        LjyLogUtil.d("etName=${etName.text}")
        LjyLogUtil.d("etPwd=${etPwd.text}")
        if ("ljy".equals(etName.text) && "123".equals(etPwd.text)) {
            LjyLogUtil.d("登录成功")
        } else {
            LjyLogUtil.d(loginErrorMessage)
        }
    }
}